﻿CREATE TABLE [account].[GeneralLedger] (
    [AccountUId]              INT                 NOT NULL,
    [ParentAccountUId]        INT                 NULL,
    [AccountId]               SMALLINT            NOT NULL,
    [ParentAccountId]         SMALLINT            NULL,
    [AccountCode]             VARCHAR (8)         NOT NULL,
    [AccountName]             VARCHAR (100)       NOT NULL,
    [AccountType]             CHAR (1)            NOT NULL,
    [AccountCateryId]         SMALLINT            NOT NULL,
    [AccountCateryCode]       CHAR (3)            NOT NULL,
    [AccountCateryName]       VARCHAR (50)        NOT NULL,
    [ParentAccountCateryName] VARCHAR (50)        NULL,
    [AccountMappingPath]      [sys].[hierarchyid] NOT NULL,
    [AccountMappingLevel]     BIGINT              NOT NULL,
    [AccountMappingStartDate] DATE                NOT NULL,
    [AccountMappingEndDate]   DATE                NOT NULL,
    [AccountOpenedDate]       DATE                NULL,
    [AccountClosedDate]       DATE                NULL,
    [AccountClosedBy]         NVARCHAR (20)       NULL,
    [AccountOrderBy]          INT                 NOT NULL,
    [IsLatest]                BIT                 NOT NULL,
    [IsActive]                BIT                 NOT NULL,
    [IsInternal]              BIT                 NOT NULL,
    [GLTypeUId]               INT                 NULL,
    [GLTypeId]                SMALLINT            NOT NULL,
    [GLTypeCode]              VARCHAR (8)         NULL,
    [GLTypeName]              VARCHAR (100)       NULL,
    [GLTypeOrderBy]           INT                 NOT NULL,
    [GLSubTypeUId]            INT                 NULL,
    [GLSubTypeId]             SMALLINT            NULL,
    [GLSubTypeCode]           VARCHAR (8)         NULL,
    [GLSubTypeName]           VARCHAR (100)       NULL,
    [GLSubTypeOrderBy]        INT                 NOT NULL,
    [GLAccountUId]            INT                 NULL,
    [GLAccountId]             SMALLINT            NULL,
    [GLAccountCode]           VARCHAR (8)         NULL,
    [GLAccountName]           VARCHAR (100)       NULL,
    [GLAccountOrderBy]        INT                 NOT NULL,
    [SubAccountUId]           INT                 NULL,
    [SubAccountId]            SMALLINT            NULL,
    [SubAccountCode]          VARCHAR (8)         NULL,
    [SubAccountName]          VARCHAR (100)       NULL,
    [SubAccountOrderBy]       INT                 NOT NULL,
    PRIMARY KEY CLUSTERED ([AccountUId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

